HAL ADC migration: List of applicable concepts ¶
This section provides information about the applicable HAL ADC architecture concepts.
Concepts for ADC ¶
|
Concept |
Description |
|---|---|
|
The init and config have been split into three functions:
|
|
|
Removal and conversion of init structure to configuration structure |
The init structure has been removed and moved to the
|
|
The handle structure has been renamed
|
|
|
The structure
|
|
|
|
|
|
New APIs are available to get and set ADC features. |
|
|
The
|
|
|
Two functions to set and get user data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each ADC event. These functions are used to register callback functions for different ADC events. |
|
|
|
|
HAL ADC APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL ADC define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL ADC driver, and equivalent services are ensured through the LL APIs. |
|
|
The ADC now is managed by three state machines:
|
|
|
The HAL ADC functions were updated to return:
|
|
|
The HAL error handling mechanisms have been redesigned to improve the detection, reporting, and handling of errors. This provides more detailed and consistent error information, like HAL_ADC_ERROR_INTERNAL and HAL_ADC_REG_ERROR_DMA. |
|
|
New APIs for filtering optional asynchronous process interrupts |
New ADC functions filter and manage asynchronous process interrupts, such as
|
|
All TypeDef parts of the HAL ADC driver have been removed and replaced by
|
|
|
For the HAL ADC driver, large macros have been replaced by inline functions to maintain code consistency, improve readability, and benefit from compiler optimization. Inline functions also offer better support for debugging and strict type management, reducing the risk of errors. |
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL ADC header file remains and all macros, define statements, and functions from
|
|
Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency. |
The HAL ADC driver provides a new function to retrieve the clock frequency:
|
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including ADC instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
Other HAL ADC changes ¶
|
Concept |
Consideration |
|---|---|
|
The HAL_ADC_Start/Stop() function have been reworked. |
The
|